<template>
  <div class="hap-studio-menu" v-show="options.show" :style="{left: `${options.x}px`, top: `${options.y}px`}">
    <div class="hap-studio-operate-item" v-for="(item, index) in menuList" :key="index">
      <div @click="selectItem($event, item)">{{item.desc}}</div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['options', 'menuList'],
  methods: {
    selectItem (event, item) {
      event.preventDefault()
      event.stopPropagation()
      this.$emit('select-item', item)
    }
  }
}
</script>
<style scoped>
  .hap-studio-menu {
    position: fixed;
    width: 150px;
    padding: 5px 5px 5px 0;
    border-radius: 5px;
    font-size: 13px;
    background: #000;
    color: #FFF;
  }
  .hap-studio-operate-item {
    height: 30px;
    line-height: 30px;
    padding-left: 10px;
    border-left: 3px solid transparent;
  }
  .hap-studio-operate-item:hover {
    color: #66B9F4;
    border-left: 3px solid currentColor;
    cursor: pointer;
  }
</style>
